#include <iostream>
#include <fstream>
#include "FileLOLCode.h"
#include "MyException.h"
#include "color.h"

FileLOLCode::FileLOLCode(std::string const& s)
{
  this->_filename = s;
  this->_FileLOLCode.open(this->_filename.data());
  if (!_FileLOLCode)
        throw new MyException (INPUT_FILE + s);
  std::cout << green <<"Inspecting file " << s << "..." << white << std::endl;
}

FileLOLCode::~FileLOLCode()
{
  this->_FileLOLCode.close();
}

std::string	FileLOLCode::getLine()
{
  std::string line = "";

  do
    getline(this->_FileLOLCode, line);
  while (line == "" && !this->_FileLOLCode.eof());
  std::cout << green << "LOLCODE : send : " << line << white <<std::endl;
  return (line);
}
